
<%@ page language="java" contentType="text/html; charset=UTF-8"
		 pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<jsp:include page="/_meta.jsp"/>
<link href="/lib/easyui/themes/default/easyui.css" rel="stylesheet" type="text/css">
<link href="/lib/easyui/themes/icon.css" rel="stylesheet" type="text/css">
<title>用户管理</title>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 用户中心 <span class="c-gray en">&gt;</span> 用户管理 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>

<div class="page-container "  style="width:1600px;height:100%;margin:0px auto">
	<table id="SockTable">
		
	</table>
	<div id="datetool" style="padding: 10px">
		<input class="easyui-datebox" style="width: 100px"/>--
		<input class="easyui-datebox" style="width: 100px"/>&nbsp;&nbsp;&nbsp;
		
		<a href="#" class="easyui-linkbutton" iconCls="icon-search" >查找</a>
	</div>
</div>
<jsp:include page="/_footer.jsp"/>
<script type="text/javascript" src="/lib/laypage/1.2/laypage.js"></script>
<script src="/lib/easyui/jquery.easyui.min.js"></script>
<script src="/lib/easyui/locale/easyui-lang-zh_CN.js"></script>
<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript">
$(function(){

});
/*用户-添加*/
function member_add(title,url,w,h){
	layer_show(title,url,w,h);
}
/*用户-查看*/
function member_show(title,url,id,w,h){
	layer_show(title,url,w,h);
}
/*用户-停用*/
function member_stop(obj,id){
	layer.confirm('确认要停用吗？',function(index){
		$.ajax({
			type: 'POST',
			url: '',
			dataType: 'json',
			success: function(data){
				$(obj).parents("tr").find(".td-manage").prepend('<a style="text-decoration:none" onClick="member_start(this,id)" href="javascript:;" title="启用"><i class="Hui-iconfont">&#xe6e1;</i></a>');
				$(obj).parents("tr").find(".td-status").html('<span class="label label-defaunt radius">已停用</span>');
				$(obj).remove();
				layer.msg('已停用!',{icon: 5,time:1000});
			},
			error:function(data) {
				console.log(data.msg);
			},
		});		
	});
}

/*用户-启用*/
function member_start(obj,id){
	layer.confirm('确认要启用吗？',function(index){
		$.ajax({
			type: 'POST',
			url: '',
			dataType: 'json',
			success: function(data){
				$(obj).parents("tr").find(".td-manage").prepend('<a style="text-decoration:none" onClick="member_stop(this,id)" href="javascript:;" title="停用"><i class="Hui-iconfont">&#xe631;</i></a>');
				$(obj).parents("tr").find(".td-status").html('<span class="label label-success radius">已启用</span>');
				$(obj).remove();
				layer.msg('已启用!',{icon: 6,time:1000});
			},
			error:function(data) {
				console.log(data.msg);
			},
		});
	});
}
/*用户-编辑*/
function member_edit(title,url,id,w,h){
	layer_show(title,url,w,h);
}
/*密码-修改*/
function change_password(title,url,id,w,h){
	layer_show(title,url,w,h);	
}
/*用户-删除*/
function member_del(obj,id){
	layer.confirm('确认要删除吗？',function(index){
		$.ajax({
			type: 'POST',
			url: '',
			dataType: 'json',
			success: function(data){
				$(obj).parents("tr").remove();
				layer.msg('已删除!',{icon:1,time:1000});
			},
			error:function(data) {
				console.log(data.msg);
			},
		});		
	});
}

    		
$($(function(){
	$("#SockTable").datagrid({
		onClickRow:function(index,field,value)
		{  
				
			$(this).datagrid('beginEdit',index);
			var ed=$(this).datagrid('getEdit',{index:index,field:field});
			$(ed.target).focus();	
		},	
		title:'报损报溢详情表',
		iconCls:'icon-edit',
		width:1600,
		height:350,
		singleSelect:true,
		toolbar:'#datetool',
		pagination:true,
		url:'GetAllProLossServlet',
		columns:[[
			{field:'takId',title:'盘点单号',width:180,align:'center'},
			{field:'stoName',title:'仓库名',width:180
			,align:'center'},
			{field:'proBarCode',title:'条形码',width:180,align:'center'},

			{field:'preinvCount',title:'盘点前数量',width:80,align:'center',
			},
			{field:'invCount',title:'盘点数量',width:80},
			{field:'proLossCount',title:'盈亏数量',width:80},
			{field:'proLossMoney',title:'盈亏金额',width:80},
			{field:'operation',title:'操作',width:80,align:'center',
				formatter:function(value,row,index){				
						var s = "<a href='#' onclick=proloss("+index+")>报损报溢</a>";
						return s;
					
					}
				}
			
		]],
		onBeforeEdit:function(index,row){
			row.editing = true;
			updateActions(index);
		},
		onAfterEdit:function(index,row){
			row.editing = false;
			updateActions(index);
		},
		onCancelEdit:function(index,row){
			row.editing = false;
			updateActions(index);
		}
	});
}));
function updateActions(index){
	$('#SockTable').datagrid('updateRow',{
		index: index,
		row:{}
	});
}
function getRowIndex(target){
	var tr = $(target).closest('tr.datagrid-row');
	return parseInt(tr.attr('datagrid-row-index'));
}
function editrow(target){
	
	$('#SockTable').datagrid('beginEdit', getRowIndex(target));
}
function deleterow(target){
	$.messager.confirm('Confirm','Are you sure?',function(r){
		if (r){
			$('#SockTable').datagrid('deleteRow', getRowIndex(target));
		}
	});
}


//报损报溢功能
function proloss(index)
{
	$('#SockTable').datagrid('selectRow',index);
	var row=$('#SockTable').datagrid('getSelected');
	if(row)
	layer_show("报损报溢","GetProLossProductMsgServlet?proBarcode="+row.proBarCode
			+"&&stoName="+row.stoName
			+"&&takId="+row.takId
			,950,800);
	
	
	}

		
function saverow(target){
	
	$('#SockTable').datagrid('endEdit', getRowIndex(target));
}
function cancelrow(target){
	$('#SockTable').datagrid('cancelEdit', getRowIndex(target));
}
function insert(){
	var row = $('#SockTable').datagrid('getSelected');
	if (row){
		var index = $('#tt').datagrid('getRowIndex', row);
	} else {
		index = 0;
	}
}
	$('#SockTable').datagrid('insertRow', {
		index: index,
		row:{
			status:'P'
		}
	});
	$('#SockTable').datagrid('selectRow',index);
	$('#SockTable').datagrid('beginEdit',index);



$("#reposity").change(function()	
		{
	
	$("#SockTable").datagrid({
		url:'GetStockProductServlet?reposity='+$("#reposity").val()
	})	
		}
		)

</script> 
</body>